package com.ruoyi.web.service;

import com.ruoyi.info.domain.CmsContent;
import com.ruoyi.info.domain.CmsInfo;
import com.ruoyi.info.domain.CmsNav;
import com.ruoyi.info.service.ICmsContentService;
import com.ruoyi.info.service.ICmsInfoService;
import com.ruoyi.info.service.ICmsNavService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("webInfo")
public class WebInfoService {
    @Autowired
    private ICmsInfoService cmsInfoService;
    @Autowired
    private ICmsNavService cmsNavService;
    @Autowired
    private ICmsContentService cmsContentService;


    /**
     * 获取Info
     * @param key
     * @return
     */
    public CmsInfo getCmsInfoBykey(String key) {
        return cmsInfoService.getByKeyCache(key);
    }

    public List<CmsInfo> getCmsInfoListBykey(String key) {
        return cmsInfoService.getCmsInfoListBykeyCache(key);
    }

    /**
     * 获取导航栏
     * @return
     */
    public List<CmsNav> getCmsNav() {
        CmsNav param = new CmsNav();
        return cmsNavService.selectCmsNavListCache(param, "cache-nav");
    }

    public List<CmsContent> getCmsContent(String kind) {
        return cmsContentService.getCmsContent(kind);
    }

    public List<CmsContent> getCmsContentByKind(String kind, String hotFlag, int limit) {
        return cmsContentService.getCmsContentByKind(kind, hotFlag, limit);
    }


}
